package controller

import (
	"cms/admin/api"
	"cms/core/response"
	"cms/dao"
	"cms/utils/random"
	"github.com/gin-gonic/gin"
)

func HomeCounter(ctx *gin.Context)  {
	c := api.Counter{
		Visit: api.CounterVisit{
			Value: random.Int(1, 100000),
			WeekAdd: random.Int(1, 100),
			WeekState: 1,
			DayAdd: random.Int(1, 100),
			DayState: 0,
			ToDay: random.Int(1, 1000),
		},
		ArticleTotal: api.CounterArticle{
			Value: random.Int(1, 100000),
			ToDay: random.Int(1, 10000),
		},
		UserTotal: api.CounterUser{
			Value: random.Int(1, 100000),
			ToDay: random.Int(1, 1000),
		},
		FeedbackTotal: api.CounterFeedback{
			Value: random.Int(1, 100),
			Total: random.Int(1, 100000),
		},
	}
	response.Success(ctx, c)
}

// ChartData 图表数据
func ChartData(ctx *gin.Context)  {
	visitList := dao.GetChartData()

	response.Success(ctx, gin.H{
		"visits": visitList,
	})
}
